package com.atyyc.controller;
import com.atyyc.result.Result;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.atyyc.pojo.User;

import java.util.Map;
import java.util.Objects;

@RestController
public class LoginController {

    //@CrossOrigin(origins = "http://192.168.31.22:8080", maxAge = 3600)

    @PostMapping("/login")
    @ResponseBody
    public Result login(@RequestBody User requestUser){

        String username = requestUser.getUsername();
        String password = requestUser.getPassword();
        if(!Objects.equals("admin", username)|| !Objects.equals("123456", requestUser.getPassword())){
            String message = "账号密码错误";
            System.out.println(requestUser);
            System.out.println("test"+username+password);
            return new Result(403, message);
        }else {
            String message = "登录成功";
            System.out.println(username);
            return new Result(200, message);

        }

    }

}
